home *** CD-ROM | disk | FTP | other *** search
- ;==========================================================================;
- ; Interrupt handler ;
- ; ;
- ; Copyright 1986, 1987, 1988 by H. Roy Engehausen. All rights reserved. ;
- ; This software may be freely distributed and used, but it may not ;
- ; under any circumstances be sold by anyone other than the author. ;
- ; It may be distributed by a commercial company as long as it is ;
- ; for no cost. ;
- ; ;
- ; Permission is explicity granted to use this code as a model for ;
- ; other programs requiring interupt driven serial I/O as long as they ;
- ; carry this copyright notice. ;
- ;==========================================================================;
-
- serint_1:
-
- PUSH SI ; Save SI so we can put
- MOV SI,interrupt_vector+0 ; Com block address in it
- JMP SHORT serint_comm ; To common code
-
- serint_2:
-
- PUSH SI ; Save SI so we can put
- MOV SI,interrupt_vector+2 ; Com block address in it
- JMP SHORT serint_comm ; To common code
-
- serint_3:
-
- PUSH SI ; Save SI so we can put
- MOV SI,interrupt_vector+4 ; Com block address in it
- JMP SHORT serint_comm ; To common code
-
- serint_4:
-
- PUSH SI ; Save SI so we can put
- MOV SI,interrupt_vector+6 ; Com block address in it
- JMP SHORT serint_comm ; To common code
-
- serint_5:
-
- PUSH SI ; Save SI so we can put
- MOV SI,interrupt_vector+8 ; Com block address in it
- JMP SHORT serint_comm ; To common code
-
- serint_6:
-
- PUSH SI ; Save SI so we can put
- MOV SI,interrupt_vector+10 ; Com block address in it
- ; JMP SHORT serint_comm ; To common code
-
- ;==========================================================================;
- ; Interrupt handler - common code ;
- ;==========================================================================;
-
- serint_comm:
-
- PUSH AX ; Save some registers
- PUSH CX ;
- PUSH DX ;
- PUSH DI ;
- PUSH DS ;
-
-
- MOV CX,CS ; Transfer CS to DS
- MOV DS,CX ; via CX
- ASSUME DS: everything ; We now have DS working
-
- MOV DX,baseaddr[SI] ; Get the base port address
-
- ;==========================================================================;
- ; Handle 8250, QuadPort, or 4 Async Port interrupts ;
- ;==========================================================================;
-
- IF present_8250
-
- CMP chip[SI],chip_8250 ; 8250?
- JE serint_8250 ; Yep!
- CMP chip[SI],chip_qrqp ; Quadram Quadport?
- JE serint_8250 ; Yep!
- CMP chip[SI],chip_4apc ; 4 Async Port Card?
- JE serint_8250 ; Yep!
-
- JMP serint_not_8250 ; Nope
- serint_8250:
-
- INCLUDE 8250INT.ASM; ; 8250 interrupt handler
-
- serint_not_8250: ; Not an 8250
-
- ENDIF
-
- ;==========================================================================;
- ; Handle 8530 interrupts ;
- ;==========================================================================;
-
- IF present_8530
-
- CMP chip[SI],chip_8530 ; 8530?
- JE serint_8530 ; Yep
- JMP serint_not_8530 ; Nope
-
- serint_8530: ;
-
- INCLUDE 8530INT.ASM ; 8530 interrupt handler
-
- serint_not_8530: ; Not an 8530
-
- ENDIF
-
- ;==========================================================================;
- ; An interrupt exit to catch screwy thing ;
- ;==========================================================================;
-
- MOV AL,pic_clear ; Tell 8259 we are done
-
- TEST options[SI],opt_high_irq ; Slave 8259 involved?
- JZ serint_pic_master ; Nope
-
- OUT pic2_cmd_port,AL ; Clear slave
-
- serint_pic_master:
- OUT pic_cmd_port,AL ; Clear master
-
- ;==========================================================================;
- ; This is where everybody exits ;
- ;==========================================================================;
-
- serint_exit: ; Everyone exits here
-
- ASSUME DS: nothing ; DS is bye bye
- POP DS ; Restore registers
- POP DI ;
- POP DX ;
- POP CX ;
- POP AX ;
- POP SI ;
-
- IRET ; Exit